function deepClone(obj){
    let result={}
    for (let key in obj) {
        if(obj[key] !== null && typeof obj[key] === 'object'){
            deepClone(obj[key], result)
        }else {
            result[key] = obj[key]
        }
    }
    // console.log(obj) // 会别调用两次
    return obj
}

const obj = {
    name: 'ck',
    age: 19,
    children:{
        name: 'child',
        age: 10
    }
}
console.log(obj)
let newObj = deepClone(obj)
console.log(newObj)


obj.name='new'
console.log(obj)
console.log(newObj)
